package com.qiyu.dubbo.router.starter;

import com.qiyu.dubbo.common.DubboService;
import com.qiyu.dubbo.router.starter.config.DubboCommonConfig;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;

/**
 * @Author linhao
 * @Date created in 2:39 下午 2020/12/26
 */
public class LocalConsumerApplication2 {

    public static void main(String[] args) throws InterruptedException {
        ApplicationConfig applicationConfig= DubboCommonConfig.buildApplication("user-consumer");
        RegistryConfig registryConfig=DubboCommonConfig.buildRegistryConfig();
        ReferenceConfig<DubboService> referenceConfig = new ReferenceConfig<>();
        referenceConfig.setInterface(DubboService.class);
        referenceConfig.setApplication(applicationConfig);
        referenceConfig.setRegistry(registryConfig);
        System.out.println("服务调用ing");
        while (true){
            referenceConfig.get().doTest("this is test");
            Thread.sleep(5000);
        }
    }
}
